package com.junzhiit.nengji.model.enums;


import com.bainaeco.framework.exception.InvalidArgumentException;

public enum PayWay {
	OTHER(-1,"其他"),
	WECHAT(0,"微信支付"),
	CASH(1,"现金分"),
	REDEEM(2,"积分(收益分)"),
	MEMBER(3,"会员卡");
	
	private Integer value;
	
	private String text;
	
	private PayWay(Integer value,String text) {
		this.value = value;
		this.text = text;
	}
	
	public int toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static PayWay toValue(Integer value) {
		if (CASH.value == value) {
			return CASH;
		} else if (OTHER.value == value) {
			return OTHER;
		} else if (WECHAT.value == value) {
			return WECHAT;
		} else if (REDEEM.value == value) {
			return REDEEM;
		}else if (MEMBER.value == value) {
			return MEMBER;
		}else {
			throw new InvalidArgumentException("Unknown PayWay[" + value + "].");
		}
	}
}
